cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)

PROJECT(ParseRST)

if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
	SET(CMAKE_DEBUG_POSTFIX "_d")
endif()

add_definitions(-DPARSERST_EXPORTS)

file(GLOB SRCS
    ./*.cpp
)

file(GLOB HDRS
    ./*.h
)

file(GLOB PYS
  ./*.py
)

file(COPY ${PYS} DESTINATION ${WORK_DIR})
source_group("Python Files" FILES ${PYS})

set(RST_CODE
    ${SRCS}
    ${HDRS}
    ${PYS}
)

add_library(${PROJECT_NAME} SHARED
    ${RST_CODE}
    #${IBE_VTK_H}
    #${IBE_COMMON_H}
)
target_link_libraries(${PROJECT_NAME}
    ${PYTHON_LIBS}
    ${PYTHON_NUMPY_LIBS}
    #${RSTODBSDK_LIB}
)

# 将dll和lib放置到指定目录下
if(WIN32)
    set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${WORK_ROOT_DIR})
    set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${WORK_ROOT_DIR})
    set_target_properties(${PROJECT_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${WORK_ROOT_DIR})
else()
    set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${WORK_DIR})
    set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${WORK_DIR})
    set_target_properties(${PROJECT_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${WORK_DIR})
endif()